package com.client.service;

import com.client.pojo.ShoppingCart;
import com.client.service.Impl.ShoppingServiceFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value = "shopping-service",path = "",fallback = ShoppingServiceFallBack.class)
public interface ShoppingService {

    // 添加商品到购物车
    @PostMapping
    public ResponseEntity<ShoppingCart> addToCart(@RequestBody ShoppingCart shoppingCart);

    // 更新购物车商品信息（如数量等）
    @PutMapping
    public ResponseEntity<ShoppingCart> updateCartItem(@RequestBody ShoppingCart shoppingCart);

    // 删除购物车商品项
    @DeleteMapping("/{cartId}")
    public ResponseEntity<Void> deleteCartItem(@PathVariable("cartId") String cartId);

    // 根据用户ID获取购物车商品列表
    @GetMapping("/user/{userId}")
    public ResponseEntity<List<ShoppingCart>> listCartItemsByUserId(@PathVariable("userId") String userId);

    // 根据购物车商品项ID获取详情
    @GetMapping("/{cartId}")
    public ResponseEntity<ShoppingCart> getCartItemById(@PathVariable("cartId") String cartId);
}
